package com.rohan.apps.mileagetracker.server.db.service;

import java.util.HashMap;
import java.util.List;

import java.util.Map;

import com.rohan.apps.mileagetracker.server.db.models.Reading;
import com.rohan.apps.mileagetracker.server.db.models.Vehicle;

public class ReadingsDao extends ObjectifyDao<Reading> {
  
	/*
	 * (non-Javadoc)
	 * @see com.rohan.apps.mileagetracker.server.db.dao.ObjectifyDao#listAllForUser()
	 * gets a list of all readings for the user
	 */
	public List<Reading> listAllReadingsForUser(){	  
		return this.listAllForUser();	  
	}
	/*
	 * Lists all readings for the user by vehicle
	 */	
	public List<Reading> listAllReadingsForUserByVehicle(Vehicle vehicle){	
		Map<String, Object> readingsBy =new HashMap<String,Object>();
		readingsBy.put("Vehicle", vehicle);
		return this.listAllForUserByProperties(readingsBy);//this.listByProperties((Map<String, Object>) (.put("Vehicle", vehicle));	  
	}	
	public void saveReadingForUser(Reading reading){
		this.put(reading);
	}
	public void deleteReadingForUser(Reading reading){
		this.delete(reading);
	}
	
}
